<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HTML和CSS示例</title>
    <link href="test.css" type="text/css" rel="stylesheet" />
</head>
<script type="text/javascript">
    var num=0
    function add_div() {
        var div=document.getElementById("main")
        var el=document.createElement("div")
        num+=1
        el.classList.add("note")
        el.innerText="这是第"+num+"个div"
        div.appendChild(el)
    }
</script>
<body>
    <h1>我是个一级标题</h1>
    <input type="button" onclick="add_div()" value="增加一个div"/>
    <div id="main"></div>
</body>
</html>